package org.ctsi.rsds.base.filter;

import com.alibaba.dubbo.rpc.Filter;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;
import com.alibaba.dubbo.rpc.RpcException;

public class ProviderFilter implements Filter{
	
	private static final String USER_TOKEN = "user_token";

	@Override
	public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
		
		Result result = null;
		
		String token = invocation.getAttachment(USER_TOKEN);
		
		if(token != null){
			result = invoker.invoke(invocation);
		}
		
		return result;
	}
	
	

}
